<?php

use yii\helpers\Html;
use yii\grid\GridView;
use backend\helpers\ActionButton;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\ConfigSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Configs';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container config-index">

    <h1 class="main-title"><?= Html::encode($this->title) ?></h1>

    <div class="action-menu action-menu__container">
        <div>
            <?= ActionButton::create('Добавить настройку', 'createConfig') ?>
        </div>
    </div>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'tableOptions' => [
            'class' => 'table table-striped'
        ],
        'columns' => [

            'id',
            'param',
            'label',
            'value',
            
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view} {update}',
                'visibleButtons' =>
                [
                    'view' => Yii::$app->user->can('browseConfig'),
                    'update' => Yii::$app->user->can('updateConfig'),
                ]
            ],
        ],
    ]); ?>


</div>
